package cn.itsource.test2._05topics;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer {
    public static final String TOPICSTEST = "TOPICSTEST";
    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory factory = new ConnectionFactory();
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(TOPICSTEST, BuiltinExchangeType.TOPIC,true);
        channel.basicPublish(TOPICSTEST, "error2.gfggg", MessageProperties.PERSISTENT_TEXT_PLAIN, "topics测试error2".getBytes());
        channel.basicPublish(TOPICSTEST, "error1.gfggg", MessageProperties.PERSISTENT_TEXT_PLAIN, "topics测试error1".getBytes());
        System.out.println("发送完毕");
    }
}